package com.zzh.controller;
/*
 * @Auther : wenrouyue
 * @Date : 2022/3/8-23:23
 */

import com.zzh.controller.utils.R;
import com.zzh.ov.UserLogin;
import com.zzh.ov.UserRegister;
import com.zzh.pojo.User;
import com.zzh.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/users")
public class UserController {
    @Autowired
    private UserServiceImpl userService;

    @PostMapping("/reguster")
    public R reguster(@RequestBody UserRegister UserRegister) {
        return userService.addUser(UserRegister);
    }
    @PostMapping("/login")
    public R login(@RequestBody User user, HttpSession session){
        return userService.Login(user,session);
    }
}